﻿@using PayrollExpress;
@using PayrollExpress.Helpers;
@using Data;

@{
    var access = BaseHelper.GetUserAccess(new DatabaseContext(), User.Identity.Name);
}


<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="sidebar-collapse">
        @if(User.Identity.IsAuthenticated)
        { 
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    
                </div>
            </li>

            <li class="@Html.IsSelected(controller: BaseHelper.ControllerName.Home.ToString())">
                <a><i class="fa fa-home"></i><span class="nav-label">@BaseHelper.ControllerName.Home.ToString()</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    <li><a href="@Url.Action(BaseHelper.Page.Index.ToString(), BaseHelper.ControllerName.Home.ToString())">@BaseHelper.ControllerName.Home.ToString()</a></li>
                </ul>
            </li>

            @if (access.HasAdministrationAccess)
            {
            <li class="@Html.IsSelected(controller: BaseHelper.ControllerName.Administration.ToString())">
                <a><i class="fa fa-gears"></i><span class="nav-label">@BaseHelper.ControllerName.Administration.ToString()</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasUsersAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.Users.ToString(), BaseHelper.ControllerName.Administration.ToString())">@BaseHelper.Page.Users.ToDescription()</a></li>
                    }
                    @if (access.HasEmploymentTypesAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.EmploymentTypes.ToString(), BaseHelper.ControllerName.Administration.ToString())">@BaseHelper.Page.EmploymentTypes.ToDescription()</a></li>
                    }
                    @if (access.HasRecurringHolidaysAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.RecurringHolidays.ToString(), BaseHelper.ControllerName.Administration.ToString())">@BaseHelper.Page.RecurringHolidays.ToDescription()</a></li>
                    }
                    @if (access.HasWorkLocationsAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.WorkLocations.ToString(), BaseHelper.ControllerName.Administration.ToString())">@BaseHelper.Page.WorkLocations.ToDescription()</a></li>
                    }
                    
                </ul>
            </li>
            }
            
            @if (access.HasMasterFilesAccess)
            {
            <li class="@Html.IsSelected(controller: BaseHelper.ControllerName.Masterfile.ToString())">
                <a><i class="fa fa-files-o"></i><span class="nav-label">@BaseHelper.ControllerName.Masterfile.ToString()</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasHolidaysAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.Holidays.ToString(), BaseHelper.ControllerName.Masterfile.ToString())">@BaseHelper.Page.Holidays.ToDescription()</a></li>
                    }
                    @if (access.HasEmployeesAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.Employees.ToString(), BaseHelper.ControllerName.Masterfile.ToString())">@BaseHelper.Page.Employees.ToDescription()</a></li>
                    }
                    @*@if (access.HasEmployeeContractsAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.EmployeeContracts.ToString(), BaseHelper.ControllerName.Masterfile.ToString())">@BaseHelper.Page.EmployeeContracts.ToDescription()</a></li>
                    }*@
                </ul>
            </li>
            }

            @if (access.HasWorkspaceAccess)
            {
            <li class="@Html.IsSelected(controller: BaseHelper.ControllerName.Workspace.ToString())">
                <a><i class="fa fa-table"></i><span class="nav-label">@BaseHelper.ControllerName.Workspace.ToString()</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasPayrollAccess)
                    {
                        <li><a href="@Url.Action(BaseHelper.Page.Payroll.ToString(), BaseHelper.ControllerName.Workspace.ToString())">@BaseHelper.Page.Payroll.ToDescription()</a></li>
                    }
                </ul>
            </li>
            }

            @if (access.HasReportsAccess)
            { 
            <li class="@Html.IsSelected(controller: BaseHelper.ControllerName.Report.ToString())">
                <a><i class="fa fa-edit"></i><span class="nav-label">@BaseHelper.ControllerName.Report.ToString()</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    <li><a href="@Url.Action("Report", "Report")">Reports</a></li>
                </ul>
            </li>
            }
        </ul>
        }
    </div>
</nav>
